Ext.namespace("SMeeting");

SMeeting.View2 = function(p) {
	this.parentWin=p
	
	this.hdSuperviseId = new Ext.form.Hidden({name:'superviseId'});
	this.hdAuditId = new Ext.form.Hidden({name:'auditId'});
	this.txtTitle = new Ext.form.TextField({
        fieldLabel: '会议名称',
        width: 540,
        name:'superviseTitle',
        disabled:true
    });
	this.txtDispatchDept = new Ext.form.TextField({
		fieldLabel: '发文部门',
		name:'dispatchDeptName',
		disabled:true,
		width: 110
	});
	this.txtAuditor = new Ext.form.TextField({
		fieldLabel: '批示人',
		name:'auditor',
		disabled:true,
		width: 110
	});
	this.txtDocDate = new Ext.form.TextField({
    	fieldLabel: '批示日期',
    	name:'auditDate',
		disabled:true,
		width:110
	});
	this.txtNotion = new Ext.form.TextArea({
		fieldLabel: '领导批示意见',
		name:'notion',
		width: 550,
		disabled:true,
		height: 30
	});
    this.txtPrincipal = new Ext.form.TextField({
		fieldLabel: '阅处负责人',
		name:'managerName',
		disabled:true,
		width: 110
	});
	this.txtInspector = new Ext.form.TextField({
		fieldLabel: '阅处人',
		name:'inspectorName',
		disabled:true,
		width: 110
	});
	this.txtInspectDate =  new Ext.form.TextField({
    	fieldLabel: '阅处日期',
    	disabled:true,
    	name:'completeDate',
    	width: 110,
		format: 'Y-m-d'
	});
	this.txtContent = new Ext.form.TextArea({
		fieldLabel: '发文内容',
		width:550,
		height:30,
		name:'superviseContent',
		disabled:true
	});
	
	this.txtReceiveDept = new Ext.form.TextField({
		fieldLabel: '收文部门',
		name:'receiveDeptName',
		disabled:true,
		width: 110
	});
	this.txtFulfill = new Ext.form.TextArea({
		fieldLabel: '落实情况',
		name:'fulfill',
		disabled:true,
		width: 550,
		height:35
	});
	this.txtFeedback = new Ext.form.TextArea({
		fieldLabel: '反馈情况',
		name:'feedback',
		disabled:true,
		width: 550,
		height:35
	});

	
	this.form = new Ext.FormPanel({
		bodyStyle: 'padding: 5px 5px 0',
        labelWidth: 85,
        labelAlign: 'right',
        region:'north',	
		height: 270,
		frame:true,
		items: [ this.txtTitle,
        	{ layout: 'column', border: false, defaults: {layout: 'form', border: false},
	        	items: [ { columnWidth: .33, items: [this.txtDispatchDept] },
	        	         { columnWidth: .33, items: [this.txtAuditor]} ]
	    },this.txtNotion,{ layout: 'column', border: false, defaults: {layout: 'form', border: false},
	        	items: [ { columnWidth: .33, items: [this.txtDocDate]},
	        	         { columnWidth: .33, items: [this.txtInspector] },
	        	         { columnWidth: .33, items: [this.txtPrincipal]} ]
	    },this.txtContent,{ layout: 'column', border: false, defaults: {layout: 'form', border: false},
	        	items: [ { columnWidth: .33, items: [this.txtInspectDate]},
	        	         { columnWidth: .33, items: [this.txtReceiveDept]} ]
	    },this.txtFeedback,this.txtFulfill]
    });
	this.store = new Ext.data.JsonStore({
	    url: '../superviseMeeting/listFeedback2.form?timesnap=' + Date.parse(new Date()),
	    root: 'result',
	    totalProperty: 'total',
        remoteSort: true,
	    fields: ['taskExeId','taskExeUpdateDate','taskId','taskExeUserId','taskExePerformType',
	    'taskExeDispatcherId','taskExeStatus','taskExePercent','taskExeBackStatus','content',
	    'taskExeUserName']
	});
	//this.store.setDefaultSort('taskFeedbackId', 'desc');
	this.renderTaskStatus = function(value){
		return OMS.TASKSEXESTATUS[value];
	}
	this.renderState = function(value){
		return OMS.SUPERVISE_STATE[value];
	};
	this.columns =  [
	    {header: '执行表ID', sortable: true, align: 'right',width: 20,hidden:true,dataIndex: 'taskExeId'},
	    {header: '负责人ID', sortable: true, align: 'center',width: 20,hidden:true,dataIndex: 'taskExeUserId'},
	    {header: '执行人', sortable: true, align: 'center',width: 20,dataIndex: 'taskExeUserName'},
		{header: '更新日期', sortable: true, align: 'right',width: 20,dataIndex: 'taskExeUpdateDate'},
		{header: '对应ID', sortable: true, align: 'right',width: 20,hidden:true,dataIndex: 'taskId'},		
		{header: '执行类型', sortable: true, align: 'right',width: 20,hidden:true,dataIndex: 'taskExePerformType'},
		{header: '派送人', sortable: true, align: 'center',width: 20,hidden:true,dataIndex: 'taskExeDispatcherId'},
		{header: '完成状态', sortable: true, align: 'right',width: 20,dataIndex: 'taskExeStatus',renderer:this.renderTaskStatus},
		{header: '完成百分比', sortable: true, align: 'right',width: 20,hidden:true,dataIndex: 'taskExePercent'},
		{header: 'TASK_EXE_BACK_STATUS', sortable: true, align: 'right',hidden:true,width: 20,dataIndex: 'taskExeBackStatus'},
		{header: '意见内容', sortable: true, align: 'center',dataIndex: 'content'}
	];
	this.grid = new Ext.grid.EditorGridPanel({
		title:'会议反馈情况',
		region: 'south',
		cm: new Ext.grid.ColumnModel(this.columns),
		store:this.store,
		height: 180,
		viewConfig: { forceFit: true },
        collapsible:true
	});	
	SMeeting.View2.superclass.constructor.call(this, {
		title: '查看会议',        
        width:700,
		height:420,
		resizable: false,
        modal: true,
        autoScroll: true,
		closeAction:'hide',
        items: [this.form,this.grid],
        buttons: [{
            text: '关闭',
            scope: this,
            handler: function() {
	        	this.hide();
        	}
        }],
        buttonAlign:'center'
	});
};
Ext.extend(SMeeting.View2, Ext.Window, {
	initWin:function(data){		
		this.form.getForm().setValues(data);
		this.grid.store.load({
			params:{auditId:data.auditId}
		});
	}
});

